<!DOCTYPE html>
<html>
<head>
    <title>佳怡供应链理财</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">

    <meta name="description" content="Write an awesome description for your new site here. You can edit this line in _config.yml. It will appear in your document head meta (for Google search results) and in your feed.xml site description.
">
    <link rel="stylesheet" href="lib/weui.min.css">
    <link rel="stylesheet" href="css/jquery-weui.css">
    <link rel="stylesheet" href="demos/css/demos.css">
    <link rel="stylesheet" href="css/common.css">
    <link rel="stylesheet" href="font/fontscss/iconfont.css">
    <script src="lib/jquery-2.1.4.js"></script>

    <style type="text/css">
        body, html {
            background: #fff;
        }

        .weui-cell {
            padding: 10px 15px;
        }

        .weui-btn_primary {
            background: #EC991C;
        }

        .weui-btn_primary:not(.weui-btn_disabled):active {
            background: #ec8c22;
        }

        .weui-uploader__file {
            width: 10rem;
            height: 8rem;
        }

        header .weui-col-33:last-child a {
            margin-right: 1.1rem;
        }

        /*.weui-btn_primary:active{
            background: #ec8c22;
        }*/
    </style>
    <script src="js/lrz.mobile.min.js"></script>
    <script src="js/select2.js"></script>
    <script src="js/select2_locale_zh-CN.js"></script>
    <link rel="stylesheet" href="js/select2.css">
    <script src="js/common.js"></script>


</head>
<body>
<header>
    <div class="weui-row weui-no-gutter">
        <div class="weui-col-33"></div>
        <div class="weui-col-33">会员注册</div>
        <div class="weui-col-33" id="ligin_icon">
            <a href="login.html">登录</a>
        </div>
    </div>
</header>
<div class="weui-cells weui-cells_form">
    <form method="post" data-url="/login" id="formlogin" method="post" enctype="multipart/form-data">
        <div class="weui-cell weui-cell_select weui-cell_select-after">
            <div class="weui-cell__hd">
                <label for="" class="weui-label">会员类型</label>
            </div>
            <div class="weui-cell__bd">
                <select class="weui-select" name="member_category" id="member_category" onchange="getXy()">
                    <option value="0">投资会员</option>
                    <option value="1">融资会员</option>
                </select>
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label"><font
                    color="red">*</font>会员姓名</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input field-text" type="text" name="username" id="username" placeholder="请输入账号"
                       data-required="true" data-descriptions="username"/>
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label"><font
                    color="red">*</font>密码</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="password" name="password" placeholder="请输入密码" id="password"/>
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label">联系电话</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="text" name="phone" placeholder="请输入联系电话" id="phone"/>
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label"><font
                    color="red">*</font>真实姓名</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="text" name="realname" placeholder="请输入真实姓名" id="realname"/>
            </div>
        </div>
        <div class="weui-cell" id="shiyebu" style="display: none">
            <div class="weui-cell__hd"><label class="weui-label"><font
                    color="red">*</font>所属事业部</label></div>
            <div class="weui-cell__bd">
                <input type="text" id="business_department" name="business_department" class="weui-input"
                       placeholder="请选择事业部">
            </div>
        </div>
        <div class="weui-cell" id="zhongxin" style="display: none">
            <div class="weui-cell__hd"><label class="weui-label">所属中心</label></div>
            <div class="weui-cell__bd">
                <input type="text" id="subordinate_center" name="subordinate_center" class="weui-input"
                       placeholder="请选择中心">
            </div>
        </div>
        <div class="weui-cell" id="xiangmubu" style="display: none">
            <div class="weui-cell__hd"><label class="weui-label">项目部</label></div>
            <div class="weui-cell__bd">
                <input type="text" id="projectDeptId" name="projectDeptId" class="weui-input" placeholder="请选择项目部">
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label"><font
                    color="red">*</font>邮箱</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="text" name="mailbox" placeholder="请输邮箱" id="mailbox"/>
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label"><font
                    color="red">*</font>地址</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="text" name="address" placeholder="请输入地址" id="address"/>
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label"><font
                    color="red">*</font>开户名</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="text" name="account_name" placeholder="请输入开户行" id="account_name"/>
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label"><font
                    color="red">*</font>账号</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="text" name="account_number" placeholder="请输入账号" id="account_number"/>
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label"><font
                    color="red">*</font>开户行</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="text" name="bank_account" placeholder="请输入开户行" id="bank_account"/>
            </div>
        </div>


        <!--上传身份证-->
        <div class="weui-cell">
            <div class="weui-cell__bd">
                <div class="weui-uploader">
                    <div class="weui-uploader__hd">
                        <p class="weui-uploader__title"><font
                                color="red">*</font>身份证正面</p>
                    </div>
                    <div class="weui-uploader__bd">
                        <ul class="weui-uploader__files" id="uploaderFiles">
                        </ul>
                        <div class="weui-uploader__input-box">
                            <input id="uploaderInput" class="weui-uploader__input" type="file" accept="image/*"/>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__bd">
                <div class="weui-uploader">
                    <div class="weui-uploader__hd">
                        <p class="weui-uploader__title"><font
                                color="red">*</font>身份证反面</p>
                    </div>
                    <div class="weui-uploader__bd">
                        <ul class="weui-uploader__files" id="uploaderFiles2">
                        </ul>
                        <div class="weui-uploader__input-box">
                            <input id="uploaderInput2" class="weui-uploader__input" type="file" accept="image/*"/>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="weui-cell" id="zizhi" style="display: none">
            <div class="weui-cell__bd">
                <div class="weui-uploader">
                    <div class="weui-uploader__hd">
                        <p class="weui-uploader__title"><font
                                color="red">*</font>资质</p>
                    </div>
                    <div class="weui-uploader__bd">
                        <ul class="weui-uploader__files" id="uploaderFiles3">
                        </ul>
                        <div class="weui-uploader__input-box">
                            <input id="uploaderInput3" class="weui-uploader__input" type="file" accept="image/*"/>
                        </div>
                    </div>
                </div>
            </div>
        </div>
       <!-- <div class="weui-cells weui-cells_checkbox" style="margin-top: -45px;" id="xieyi1">-->
           <!-- <label class="weui-cell weui-check__label" for="s11">
                <div class="weui-cell__hd">
                   <input type="checkbox"  name="checkbox1" id="s11">
                    使用<a href="javascript:void(0)" onclick="xieYi()">服务协议</a>
                    &lt;!&ndash;<i class="weui-icon-checked"></i>&ndash;&gt;
                </div>
                &lt;!&ndash; <div class="weui-cell__bd">
                     <p>standard is dealt for u.</p>
                 </div>&ndash;&gt;
            </label>-->

        <div class="weui-cells weui-cells_form" id="xieyi">
            <div class="weui-cell weui-cell_switch">
                <div class="weui-cell__ft">
                    <input class="weui-switch" type="checkbox" id="s11">
                </div>
                <div style="    margin-left: 20px;">使用<a href="javascript:void(0)" onclick="xieYi()">服务协议</a></div>
            </div>

        </div>

        <div class="weui-loadmore" id="jiazai" style="display: none">
            <i class="weui-loading"></i>
            <span class="weui-loadmore__tips">正在加载</span>
        </div>
               <!-- <input type="checkbox"  name="checkbox1" id="s11">
                使用<a href="javascript:void(0)" onclick="xieYi()">服务协议</a>-->


        <!--</div>-->
        <!--<div id="xieyi2" style="position:absolute;margin-left: 50px;margin-top: 20px;">
            使用<a href="javascript:void(0)" onclick="xieYi()">服务协议</a>
        </div>-->

        <input type="hidden" id="imgs" name="imgs"/>
        <input type="hidden" id="imgs2" name="imgs2"/>
        <input type="hidden" id="imgs3" name="imgs3"/>
        <input type="hidden" id="imgsname" name="imgsname"/>
        <input type="hidden" id="imgsname2" name="imgsname2"/>
        <input type="hidden" id="imgsname3" name="imgsname3"/>


    </form>
    <div class="weui-btn-area" style="margin-top: 70px;">

        <a class="weui-btn weui-btn_primary" id="conf">注册</a>
    </div>
</div>

<script src="lib/fastclick.js"></script>
<script>
    $(function () {
        FastClick.attach(document.body);
    });
</script>
<script src="js/jquery-weui.js"></script>
<script type="application/javascript">
    var storage = window.localStorage;
    $(function () {
        var tmpl = '<li class="weui-uploader__file" style="background-image:url(#url#)"></li>',
            $uploaderInput = $("#uploaderInput"), $uploaderFiles = $("#uploaderFiles");
        $uploaderInput.on("change", function (e) {

            var src, url = window.URL || window.webkitURL || window.mozURL, files = e.target.files;
            for (var i = 0, len = files.length; i < len; ++i) {
                var file = files[i];
                lrz(file, {width: 640, quality: 0.9}, function (rst) {
                    $("#imgs").val(rst.base64);
                    $("#imgsname").val(rst.origin.name);

                });
                if (url) {
                    src = url.createObjectURL(file);
                } else {
                    src = e.target.result;
                }
                if ($uploaderFiles.find(".weui-uploader__file").length > 0) {
                    $uploaderFiles.find(".weui-uploader__file").css("background-image", "url(" + src + ")");
                } else {
                    $uploaderFiles.append($(tmpl.replace('#url#', src)));
                }

            }

        })
        var $uploaderInput2 = $("#uploaderInput2"), $uploaderFiles2 = $("#uploaderFiles2");
        $uploaderInput2.on("change", function (e) {
            var src, url = window.URL || window.webkitURL || window.mozURL, files = e.target.files;
            for (var i = 0, len = files.length; i < len; ++i) {
                var file = files[i];
                lrz(file, {width: 640, quality: 0.9}, function (rst) {
                    $("#imgs2").val(rst.base64);
                    $("#imgsname2").val(rst.origin.name);
                });
                if (url) {
                    src = url.createObjectURL(file);
                } else {
                    src = e.target.result;
                }
                if ($uploaderFiles2.find(".weui-uploader__file").length > 0) {
                    $uploaderFiles2.find(".weui-uploader__file").css("background-image", "url(" + src + ")");
                } else {
                    $uploaderFiles2.append($(tmpl.replace('#url#', src)));
                }
            }

        })

    });
    $("#conf").click(function () {
        var flag = true;
        var flag2 = true;
        /* alert($("#imgsname").val());
         alert($("#imgsname2").val());*/
        var che = $("#s11").is(':checked');
        if (validate()) {

            if ($("#member_category").val() == 1) {
                if ($.trim($("#business_department").val()) == null || "" == $.trim($("#business_department").val())) {
                    $.toast("所属事业部不能为空");
                    return false;
                }
                if ($.trim($("#imgsname3").val()) == null || "" == $.trim($("#imgsname3").val())) {
                    $.toast("请上传资质");
                    return false;
                } else {

                        $.showLoading("正在注册中");
                    $.ajax({
                        type: "POST",
                        url: 'login/reg',
                        async: false,
                        data: $("#formlogin").serialize(),
                        success: function (msg) {
                            $.hideLoading();
                            $.toast("注册成功");
                            localStorage.setItem("username", msg.username);
                            localStorage.setItem("token", msg.uuid);
                            setTimeout(function () {
                                window.location.href = "touzi.html"
                            }, 1000);
                        },
                        error: function (returndata) {
                            $.hideLoading();
                            $.toast("注册失败，请检查网络或者联系管理员");
                        }
                    });
                }
            }
            if ($("#member_category").val() == 0 && che == false) {
                $.toast("请勾选服务协议");
                return false;
            } else {
                $.showLoading("正在注册中");
               //$("#formlogin").showLoading();
                /*setTimeout(function () {
                    $.showLoading("正在注册中");
                    alert("dfhs2");
                },100);*/
                $.ajax({
                    type: "POST",
                    url: 'login/reg',
                    async: false,
                    data: $("#formlogin").serialize(),
                    success: function (msg) {
                        $.hideLoading();
                        //$("#formlogin").hideLoading()
                        $.toast("注册成功");
                        localStorage.setItem("username", msg.username);
                        localStorage.setItem("token", msg.uuid);
                        setTimeout(function () {
                            window.location.href = "touzi.html"
                        }, 1000);
                    },
                    error: function (returndata) {
                        $.hideLoading();
                        $.toast("注册失败，请检查网络或者联系管理员");
                    }
                });
            }
            /* if (flag == true || flag2 == true) {


             $.showLoading("正在注册中");
             $.ajax({
             type: "POST",
             url: 'login/reg',
             async: false,
             data: $("#formlogin").serialize(),
             success: function (msg) {
             $.hideLoading();
             $.toast("注册成功");
             localStorage.setItem("username", msg.username);
             localStorage.setItem("token", msg.uuid);
             setTimeout(function () {
             window.location.href = "touzi.html"
             }, 1000);
             },
             error: function (returndata) {
             $.hideLoading();
             $.toast("注册失败，请检查网络或者联系管理员");
             }
             });

             }*/
            /*  if ($("#member_category").val() == 1) {
             alert("3");
             if ($.trim($("#business_department").val()) == null || "" == $.trim($("#business_department").val())) {
             $.toast("所属事业部不能为空");
             return false;
             } else {

             if ($.trim($("#imgsname3").val()) == null || "" == $.trim($("#imgsname3").val())) {
             $.toast("请上传资质");
             } else {
             if (che == false && $("#member_category").val() == 0) {
             alert("4");
             $.toast("请勾选服务协议");
             return false;
             } else {
             $.showLoading("正在注册中");
             $.ajax({
             type: "POST",
             url: 'login/reg',
             async: false,
             data: $("#formlogin").serialize(),
             success: function (msg) {
             $.hideLoading();
             $.toast("注册成功");
             localStorage.setItem("username", msg.username);
             localStorage.setItem("token", msg.uuid);
             setTimeout(function () {
             window.location.href = "touzi.html"
             }, 1000);
             },
             error: function (returndata) {
             $.hideLoading();
             $.toast("注册失败，请检查网络或者联系管理员");
             }
             });
             }
             }
             }

             }*/
        }


    });
    function callback(img) {
        alert(img);
    }


    /*$("#usertype").click(function () {
     $.actions({
     actions: [{
     text: "投资会员",
     onClick: function() {
     $("#usertype").text("投资会员");
     $("#usertype").val("0");
     }
     },{
     text: "融资会员",
     onClick: function() {
     //do somethin
     $("#usertype").text("融资会员");
     $("#usertype").val("1");
     }
     }]
     });
     })*/

    $("#business_department").select2({
        placeholder: "请输入大区名称", //默认文本框显示信息
        minimumInputLength: 1, //最小输入字符长度
        allowClear: true,
        multiple: false, //设置多项选择，false则只能单选
        maximumSelectionSize: 5, //最大选择个数
        query: function (query) {
            $.ajax({
                type: "POST",
                //url : "insti.do?method=getCurrent",
                url: "login/getDepartment?flag=1",
                data: {
                    dept: query.term
                }, //传递你输入框中的值
                success: function (msg) {
                    var msg = $.parseJSON(msg);
                    var data = {
                        results: []
                    };
                    $.each(msg, function (x, y) {
                        data.results.push({
                            id: y.id,
                            text: y.name
                        });
                        ;
                    });
                    query.callback(data);
                }
            });
        }
    });
    $("#subordinate_center").select2({
        placeholder: "请输入中心名称", //默认文本框显示信息
        minimumInputLength: 0, //最小输入字符长度
        allowClear: true,
        multiple: false, //设置多项选择，false则只能单选
        maximumSelectionSize: 5, //最大选择个数
        query: function (query) {
            $.ajax({
                type: "POST",
                //url : "insti.do?method=getCurrent",
                url: "login/getDepartment?flag=" + 2 + "&fatherId=" + $("#business_department").val(),
                data: {
                    dept: query.term
                }, //传递你输入框中的值
                success: function (msg) {
                    var msg = $.parseJSON(msg);
                    var data = {
                        results: []
                    };
                    $.each(msg, function (x, y) {
                        data.results.push({
                            id: y.id,
                            text: y.name
                        });
                        ;
                    });
                    query.callback(data);
                }
            });
        }
    });
    $("#projectDeptId").select2({
        placeholder: "请输入项目部名称", //默认文本框显示信息
        minimumInputLength: 0, //最小输入字符长度
        allowClear: true,
        multiple: false, //设置多项选择，false则只能单选
        maximumSelectionSize: 5, //最大选择个数
        query: function (query) {
            $.ajax({
                type: "POST",
                //url : "insti.do?method=getCurrent",
                url: "login/getDepartment?flag=" + 3 + "&fatherId=" + $("#subordinate_center").val(),
                data: {
                    name: query.term
                }, //传递你输入框中的值
                success: function (msg) {
                    var msg = $.parseJSON(msg);
                    var data = {
                        results: []
                    };
                    $.each(msg, function (x, y) {
                        data.results.push({
                            id: y.id,
                            text: y.name
                        });
                        ;
                    });
                    query.callback(data);
                }
            });
        }
    });

    function xieYi() {
        window.location.href = "xieyi.html";

    }
    function getXy() {
        if ($("#member_category").val() == 1) {//融资
            $("#zizhi").css("display", "block")
            $("#xieyi1").css("display", "none")
            $("#xieyi").css("display", "none")
            $("#xieyi2").css("display", "none")
            $("#shiyebu").css("display", "block")
            $("#zhongxin").css("display", "block")
            $("#xiangmubu").css("display", "block")
            var tmpl = '<li class="weui-uploader__file" style="background-image:url(#url#)"></li>',
                $uploaderInput3 = $("#uploaderInput3"), $uploaderFiles3 = $("#uploaderFiles3");
            $uploaderInput3.on("change", function (e) {
                var src, url = window.URL || window.webkitURL || window.mozURL, files = e.target.files;
                for (var i = 0, len = files.length; i < len; ++i) {
                    var file = files[i];
                    lrz(file, {width: 640, quality: 0.9}, function (rst) {
                        $("#imgs3").val(rst.base64);
                        $("#imgsname3").val(rst.origin.name);
                    });
                    if (url) {
                        src = url.createObjectURL(file);
                    } else {
                        src = e.target.result;
                    }
                    if ($uploaderFiles3.find(".weui-uploader__file").length > 0) {
                        $uploaderFiles3.find(".weui-uploader__file").css("background-image", "url(" + src + ")");
                    } else {
                        $uploaderFiles3.append($(tmpl.replace('#url#', src)));
                    }
                }

            })
            // $("#xieyi1").hide();
        }
        if ($("#member_category").val() == 0) {//投资
            $("#zizhi").css("display", "none")
            $("#xieyi1").css("display", "block")
            $("#xieyi").css("display", "block")
            $("#xieyi2").css("display", "block")
            $("#shiyebu").css("display", "none")
            $("#zhongxin").css("display", "none")
            $("#xiangmubu").css("display", "none")
        }
    }
    function demo() {
        //var ches=false;
        alert("2");

    }
</script>
<script src="js/web/checkLogin.js"></script>
</body>

</html>